<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags"%> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'adminList.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<!--框架必需start-->
<script type="text/javascript" src="ui/js/jquery.js"></script>
<script type="text/javascript" src="ui/js/Validform_v5.3.2.js"></script>
<script type="text/javascript" src="ui/js/framework.js"></script>
<link href="ui/css/import_basic.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" id="skin" prePath="/"/>
<link rel="stylesheet" type="text/css" id="customSkin"/>
<link href="ui/skins/blue/style.css" rel="stylesheet" type="text/css" id="theme" themeColor="blue"/>
<!--框架必需end-->
  <body>
 
	<div class="box2" panelTitle="新建管理站" style="margin-left: auto;margin-right: auto;float: left;width: 100%;">
		<fieldset>
			<form action="msAdd.action" method="post" class="registerform">
		<table class="tableStyle" formMode="transparent">
			<tr>
				<td>管理站名称:</td>
				<td><input type="text" id="MSName" name="station.MSName" datatype="s3-10" errormsg="名称至少3个字符,最多10个字符！"/></td>
				<td><div class="Validform_checktip"></div></td>
			</tr>
			<tr>	
				<td>管理站IP地址:</td>
				<td><input type="text" id="MSIp" name="station.MSIp" datatype="*" errormsg="不能为空！"/></td>
				<td><div class="Validform_checktip"></div></td>
			</tr>	
			<tr>
				<td>
					<input type="submit" value="添加"/>
				</td>
				<td>
					<input type="reset" value=" 重 置 "/>
				</td>
			</tr>
		</table>
		</form>
		 </fieldset>
	</div>	

	<div id="scrollContent" style="float: left;width: 100%">
	<table class="tableStyle" useClick="false" id="list" style="text-align: center;">
			<tr>
				<th width="5%" >编号</th>
				<th width="25%" >管理站名称</th>
				<th width="20%" >管理站IP地址</th>
				<th width="20%" >初始派遣状态</th>
				<th width="25%">操作</th>
			</tr>
			<s:iterator value="MSList"  var="ml">
				<tr>
				<td><s:property value="#ml.MSId"/></td>
				<td><s:property value="#ml.MSName"/></td>
				<td><s:property value="#ml.MSIp"/></td>
				<td>
					<s:if test="#ml.IsInitialize==1">
						已完成
					</s:if>
					<s:else>
						未完成
					</s:else>
				</td>
				<td><span class="img_edit hand" title="修改" ></span><span class="img_delete hand"  title="删除"></span></td>
			</tr>
			</s:iterator>		
		</table>	
	</div>		
		<script type="text/javascript">
		$(function(){
			//$(".registerform").Validform();  //就这一行代码！;
	
			$(".registerform").Validform({
				tiptype:2
			});
		})
	</script>
	<script>
		var id;
		var MSName;
		var MSIp;
		var $currentTr;
		$(function(){
			$(".img_btn_up").click(function(){
				upHandler($(this));
			});
			$(".img_delete").click(function(){
				delHandler($(this));
			});
			$(".img_edit").click(function(){
				modiHandler($(this));
			});
		});
		//删除
		function delHandler($obj){
			top.Dialog.confirm("确定要删除吗？",function(){
				id=$obj.parents("tr").find("td").eq(0).html();
				location.href='msDel.action?msId='+id;
			});
		}	
		//弹出修改窗口
		/*
		function modiHandler($obj){
			top.Dialog.open({URL:"./admin/MSMod.jsp",Title:"修改",Width:500,Height:240});
			id=$obj.parents("tr").find("td").eq(0).html();
			MSName=$obj.parents("tr").find("td").eq(1).html();
			MSIp=$obj.parents("tr").find("td").eq(2).html();
			$currentTr=$obj.parents("tr");
		}
		*/
		//修改赋值
		function refreshRow(val0,val1,val2,val3){
			$currentTr.find("td").eq(0).html(val0);
			$currentTr.find("td").eq(1).html(val1);
			$currentTr.find("td").eq(2).html(val2);
			$currentTr.find("td").eq(3).html(val3);
		}
		function modiHandler($obj){
			var msId=$obj.parents("tr").find("td").eq(0).html();
		   //	var taskKind=$obj.parents("tr").find("td").eq(1).html(); 
			//$("#lineChart").src='jfreechart.action?taskId='+taskId+'&taskKind='+taskKind;
			//$("#lineChart").location.reload();
			location.href='getMSById.action?msId='+msId;
		}
	</script>
</body>
</html>
